package com.zhiyou.app.shop.common.util;

import org.apache.struts2.ServletActionContext;
import org.hibernate.criterion.DetachedCriteria;

import com.zhiyou.app.shop.manager.dao.pojo.UserDetail;

public class ServiceUtil {

	
	public static DetachedCriteria getADetachedCriteria(Class clazz){
		return DetachedCriteria.forClass(clazz);
	}
	
	//TODO 要删除的
	public static UserDetail getCurrentUser() {
		Object obj = ServletActionContext.getRequest().getSession().getAttribute("user");
		UserDetail ud = null;
		if(null != obj && obj instanceof UserDetail){
			ud = (UserDetail) obj;
		}
		return ud;
	}
}
